*Article "Explaining the Allocation of Legislative Specialization"
*Japanese Journal of Political Science (JJPS)
*By Aldo F. Ponce  (CIDE)

*Regression Models 
*Please use "Cross sectional dataset - Aldo F Ponce.dta" dataset

*NOTES
* AnoDiscriminadoTodo12: "Gini Coefficient"
* herfindahl: "Herfindahl Index"
* politicalpartyinejecutive: "Ruling Party"
*laaksotaggaperasincoalicion: "Effective Number of Political Parties"
*dmagnitude: "District Magnitude"
* Giniweighted12: "Weighted Gini Coefficient"


* TABLE 1
fmlogit  MAnoDiscriminadoTodo12 AnoDiscriminadoTodo12, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive)   cluster(id) difficult iter(20)

fmlogit  MAnoDiscriminadoTodo12 AnoDiscriminadoTodo12, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive laaksotaggaperasincoalicion)   cluster(id) difficult iter(20)


fmlogit  Mherfindahl  herfindahl, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive)   cluster(id) difficult iter(20)

fmlogit  Mherfindahl  herfindahl, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive laaksotaggaperasincoalicion)   cluster(id) difficult iter(20)

* FIGURE 1
*from model 2
fmlogit  MAnoDiscriminadoTodo12 AnoDiscriminadoTodo12, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive laaksotaggaperasincoalicion)   cluster(id) difficult iter(20)
margins, at(size_of_the_party=(1(5)75)) noatlegend
marginsplot, yline(0) title("Expected Values of the Gini Coefficient")

*from model 4
fmlogit  herfindahl Mherfindahl, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive laaksotaggaperasincoalicion)   cluster(id) difficult iter(20)
margins, at(size_of_the_party=(1(5)75)) noatlegend
marginsplot, yline(0) title("Expected Values of the Herfindahl Index")

*Online Appendix J (fractional response models) using clustered standard errors

fracreg logit  AnoDiscriminadoTodo12  c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive,   vce(cluster partyid2)

fracreg logit  herfindahl  size_of_the_party   size_of_the_party_square  electoralvolatility   congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive, vce(cluster partyid2)


*Online Appendix K. Table 1. Employing country, party and period Fixed Effects

fracreg logit  AnoDiscriminadoTodo12  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive i.id  

fracreg logit  herfindahl  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive i.id

truncreg  AnoDiscriminadoTodo12  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.partyid2 , ll(0) vce(robust) 

truncreg  herfindahl  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive i.partyid2, ll(0) vce(robust)

fracreg logit  AnoDiscriminadoTodo12  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.periodID  

fracreg logit  herfindahl  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.periodID


*Online Appendix K. Table 2. Employing party and period Fixed Effects


xtreg AnoDiscriminadoTodo12 c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.partyid2, i(id)  vce(robust) mle

xtreg herfindahl c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.partyid2, i(id)   vce(robust) mle

xtreg AnoDiscriminadoTodo12  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.periodID  , i(id)   vce(robust) mle

xtreg  herfindahl  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.periodID, i(id)   vce(robust) mle


* Online Appendix K. Table 3. Employing additional variables (dictrict magnitude)

fmlogit  MAnoDiscriminadoTodo12 AnoDiscriminadoTodo12, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  dmagnitude)   cluster(id) difficult iter(20)

fmlogit  Mherfindahl herfindahl, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  dmagnitude)   cluster(id) difficult iter(20)

* Online Appendix K. Table 4. Employing additional variables (seat volatility)

fmlogit  MAnoDiscriminadoTodo12 AnoDiscriminadoTodo12, eta(c.size_of_the_party##c.size_of_the_party    seatvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive ) cluster(id) difficult iter(20)

fmlogit  Mherfindahl  herfindahl, eta(c.size_of_the_party##c.size_of_the_party    seatvolatility  congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive )   cluster(id) difficult iter(20)


*Online Appendix L Weighted Gini coefficient

fmlogit  MGiniweighted12 Giniweighted12, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive )   cluster(id) difficult iter(20)

* Online Appendix M (all bill initiatives, including regional)

fmlogit  MAñoSinDiscriminarTodo12 AñoSinDiscriminarTodo12, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive )   cluster(id) difficult iter(20)

fmlogit  Mherfindahlr  herfindahlr, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive )   cluster(id) difficult iter(20)

* Online Appendix N (excluding the smallest parties)

fmlogit  MAnoDiscriminadoTodo12 AnoDiscriminadoTodo12 if size_of_the_party>1 , eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive)   cluster(id) difficult iter(20)

fmlogit  Mherfindahl  herfindahl if size_of_the_party>1, eta(c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive)   cluster(id) difficult iter(20)


* Online Appendix O (Tobit multilevel Models)

xttobit  AnoDiscriminadoTodo12  size_of_the_party size_of_the_party_square    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive   , ll(0) ul(1) i(id)

xttobit  herfindahl  size_of_the_party size_of_the_party_square electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive , ll(0)  ul(1) i(id)

* Online Appendix P (panel) Please use the "Panel dataset - Aldo F Ponce.dta" dataset

xtreg AnoDiscriminadoTodo12 lagAnoDiscriminadoTodo12 c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  , re

xtreg   herfindahl  lagherfindahl  c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive   , re


*Online Appendix Q (panel) country, party, and period fixed effects. Please use the "Panel dataset - Aldo F Ponce.dta" dataset

xtreg AnoDiscriminadoTodo12 lagAnoDiscriminadoTodo12 c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.id, re

xtreg   herfindahl  lagherfindahl  c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.id , re

xtreg AnoDiscriminadoTodo12 lagAnoDiscriminadoTodo12 c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.partyid2, re

xtreg   herfindahl  lagherfindahl  c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.partyid2 , re

xtreg AnoDiscriminadoTodo12 lagAnoDiscriminadoTodo12 c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.periodID, re

xtreg   herfindahl  lagherfindahl  c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive  i.periodID , re

* Online Appendix R (poststratification), Please use again the "Cross sectional dataset - Aldo F Ponce.dta" dataset

svyset _n [pweight=weight], strata(id)
svy: fracreg logit AnoDiscriminadoTodo12  c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive


svy: fracreg logit herfindahl    c.size_of_the_party##c.size_of_the_party    electoralvolatility congresscapabilitiesindex  centralizationindex  politicalpartyinejecutive



